home *** CD-ROM | disk | FTP | other *** search
- ' Caption: Select Block|
- ' Hint: Select Block in active editor|
- ' Icon: |
- '
- ' syn
- ' Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
- ' stievie@utanet.at, http://web.utanet.at/ascherst/
- '
- ' The contents of this file are subject to the Mozilla Public License
- ' Version 1.1 (the "License"); you may not use this file except in compliance
- ' with the License. You may obtain a copy of the License at
- ' http://www.mozilla.org/MPL/
- '
- ' Software distributed under the License is distributed on an "AS IS" basis,
- ' WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- ' the specific language governing rights and limitations under the License.
- '
- ' The Original Code is selblock.vbs, released Sun, 26 May 2002 10:55:39 UTC.
- '
- ' The Initial Developer of the Original Code is Ascher Stefan.
- ' Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
- ' All Rights Reserved.
- '
- ' Contributor(s): .
- '
- ' Alternatively, the contents of this file may be used under the terms of the
- ' GNU General Public License Version 2 or later (the "GPL"), in which case
- ' the provisions of the GPL are applicable instead of those above.
- ' If you wish to allow use of your version of this file only under the terms
- ' of the GPL and not to allow others to use your version of this file
- ' under the MPL, indicate your decision by deleting the provisions above and
- ' replace them with the notice and other provisions required by the GPL.
- ' If you do not delete the provisions above, a recipient may use your version
- ' of this file under either the MPL or the GPL.
- '
- ' You may retrieve the latest version of this file at the syn home page,
- ' located at http://syn.sourceforge.net/
- '
- ' $Id: selblock.vbs,v 1.3.2.6 2003/09/14 17:52:56 neum Exp $
-
- option explicit
-
- '#include <consts>
-
- dim txtBX, txtBY, txtEX, txtEY
- dim btnOK, btnCancel
-
- sub FormShow(Sender)
- txtBX.Text = CStr(ActiveDocument.BlockBeginX)
- txtBY.Text = CStr(ActiveDocument.BlockBeginY)
- txtEX.Text = CStr(ActiveDocument.BlockEndX)
- txtEY.Text = CStr(ActiveDocument.BlockEndY)
- end sub
-
- sub EditChange(Sender)
- btnOK.Enabled = IsNumeric(txtBX.Text) and IsNumeric(txtBY.Text) and _
- IsNumeric(txtBY.Text) and IsNumeric(txtEY.Text)
- end sub
-
- sub EditKeyPress(Sender, Key)
- const IntChars = "1234567890"
- if InStr(Key, IntChars) = 0 then
- Key = 0
- end if
- end sub
-
- sub Main(dummy)
- if Documents.Count = 0 then
- MsgBox "No Document open.", vbCritical
- exit sub
- end if
- dim Form
- dim lblBX, lblBY, lblEX, lblEY
- Form = Create("TForm", Self)
- with Form
- .Caption = "Select Block"
- .Position = "poOwnerFormCenter"
- .BorderStyle = "bsDialog"
- .Width = 215
- .Height = 123
- .OnShow = "FormShow"
- end with
- txtBX = Create("TEdit", Form)
- with txtBX
- .Parent = Form
- .Left = 55
- .Top = 8
- .Width = 50
- .Height = 21
- .OnChange = "EditChange"
- end with
- lblBX = Create("TLabel", Form)
- with lblBX
- .Parent = Form
- .Caption = "&Begin X:"
- .Left = 8
- .Top = 12
- .FocusControl = txtBX
- end with
- txtBY = Create("TEdit", Form)
- with txtBY
- .Parent = Form
- .Left = 55
- .Top = 30
- .Width = 50
- .Height = 21
- .OnChange = "EditChange"
- end with
- lblBY = Create("TLabel", Form)
- with lblBY
- .Parent = Form
- .Caption = "B&egin Y:"
- .Left = 8
- .Top = 34
- .FocusControl = txtBY
- end with
- txtEX = Create("TEdit", Form)
- with txtEX
- .Parent = Form
- .Left = 150
- .Top = 8
- .Width = 50
- .Height = 21
- .OnChange = "EditChange"
- end with
- lblEX = Create("TLabel", Form)
- with lblEX
- .Parent = Form
- .Caption = "End &X:"
- .Left = 110
- .Top = 12
- .FocusControl = txtEX
- end with
- txtEY = Create("TEdit", Form)
- with txtEY
- .Parent = Form
- .Left = 150
- .Top = 30
- .Width = 50
- .Height = 21
- .OnChange = "EditChange"
- end with
- lblEY = Create("TLabel", Form)
- with lblEY
- .Parent = Form
- .Caption = "End &Y:"
- .Left = 110
- .Top = 34
- .FocusControl = txtEY
- end with
- btnCancel = Create("TButton", Form)
- with btnCancel
- .Parent = Form
- .Top = 65
- .Caption = "Cancel"
- .Left = 126
- .Cancel = true
- .ModalResult = mrCancel
- end with
- btnOK = Create("TButton", Form)
- with btnOK
- .Parent = Form
- .Top = 65
- .Caption = "OK"
- .Left = 46
- .Default = true
- .ModalResult = mrOK
- end with
-
- if Form.ShowModal = mrOK then
- ActiveDocument.SelectRange CInt(txtBX.Text), CInt(txtBY.Text), _
- CInt(txtEX.Text), CInt(txtEY.Text)
- end if
-
- Form.Free
- end sub
-